package br.com.millenium.service.cliente.processaction;

import lumis.doui.processaction.ProcessActionHandler;
import lumis.portal.PortalException;
import br.com.millenium.domain.manager.MilleniumManagerFactory;

/**
 * Verifica se existe grupo com o mesmo nome.
 */
@SuppressWarnings("rawtypes")
public class CheckDuplicateGrupoProcessActionHandler extends ProcessActionHandler
{
	@Override
	public void processAction() throws PortalException 
	{
		String grupoNome = (String)getParameter( "nome" );
		String grupoId   = (String)(getParameter( "id" ) == null ? "" : getParameter( "id" ));
		
		if( MilleniumManagerFactory.getClienteManager().isDuplicateGrupo(grupoNome, grupoId, transaction) )
			throw new PortalException( "STR_GRUPO_EXISTS;", getResource() );
	}
}
